import "package:flutter/material.dart";

class ProfilePage extends StatefulWidget {
    
    final String text;
    
    ProfilePage({Key key, this.text});
    
    @override
    _ProfilePageState createState() => _ProfilePageState();
}

class _ProfilePageState extends State<ProfilePage> {
    @override
    Widget build(BuildContext context) {
        return Scaffold(
            appBar: PreferredSize(
                preferredSize: Size.fromHeight(36.0),
                child: AppBar(
                    centerTitle: true,
                    elevation: 0.5,
                    titleSpacing: 0.0,
                    title: Text(widget.text),
                ),
            ),
            body: Container(
                child: PageView.builder(
                    itemCount: 3,
                    physics: ScrollPhysics(),
                    onPageChanged: (index) {
                        print('pageChanged');
                        setDates();
                    },
                    itemBuilder: (context, index) {
                        print('itemBuilder');
                        return Text(index.toString());
                    },
                ),
            ),
        );
    }
    
    setDates(){
        print('setDates');
    }
}
